﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

using SharedGenomics.Workbench.Core;
using SharedGenomics.Core;

namespace SharedGenomics.Workbench.Views.WindowsForms
{
    public class TreeNodeMenuItem : TreeNode, IMenuItem
    {
        public void AddSubMenu(IMenuItem menu)
        {
            TreeNode node = menu as TreeNode;
            if (node != null)
                this.Nodes.Add(node);
            else
                throw new ArgumentException("Cannot convert menu item to TreeNode");
        }

        public string DisplayText
        {
            get { return this.Text; }
            set { this.Text = value; }
        }

        public bool IsEnabled
        {
            get
            {
                throw new NotImplementedException();
            }
            set
            {
                throw new NotImplementedException();
            }
        }

        public ICommand Command { get; set; }

        public IEnumerable<IMenuItem> SubMenus
        {
            get
            {
                return this.Nodes.OfType<IMenuItem>();
            }
        }
    }
}
